<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<table>
			<tr>
				<th>序号</th>
				<th>姓名</th>
				<th>性别</th>
				<th>宿舍</th>
			</tr>
			<tr>
				<td>1</td>
				<td>张三</td>
				<td>13</td>
				<td>三栋515</td>
			</tr>  
			<tr>
				<td>2</td>
				<td>李四</td>
				<td>16</td>
				<td>三栋515</td>
			</tr>
		</table>
		
		<script type="text/javascript">
			//定义到tbody标签下
			var tbody = document.body.querySelector('table').querySelector('tbody')
			function gg(tbody){
				// 输出数据 Array.from转换为数组的方法
				 return Array.from(tbody.children).map(tr => Array.from(tr.children).map(y => y.textContent))
			}
			//输出函数
			console.log(gg(tbody))
		</script>
	</body>
</html>
